<?php
namespace App\Http\Controllers\Front;

use App\Service\Front\PayService;
use Illuminate\Http\Request;

class PayZfbController1114 extends BaseController
{
    //支付

    //必须的参数
    protected $app_id = '2021004194624726';
    protected $rsaPrivateKeyFilePath = '';
    protected $rsaPrivateKey = 'MIIEowIBAAKCAQEAnLgv5fv2ernleOuSR2val8nmWWp42XPZrD9HNpgR/rDy7D/u2QDXzEbKyNZhe26vTo7uxC9vVczRD5iwBCGXLdrCSFPZdbtuqHH0MTb6WEVE3hhPWZ89WMN5TiQwtMjdBLBeNgXC2JyP6uxAItQgpQnPjwcVua5UsUNG2P89/g6YISfrYBpYZVF57ennlePPwhHYnYlTrdRlPP39JOEiz5YfBIlm3ZTFMSfSgHQKWVipJuR+/zhKb53msmZqs18RNpGm3TEedfgQYMOd6z5Ybl6s1oEd9o5n2VDzRrLXKrA7dKrEKjeEGztZNXV6LvShU2kq+j1/mauuaS7XBLAW/QIDAQABAoIBABz5IEHQdxzxSS81vfFeSydMuD1HpdftxwxFFpFNQ+ZmKELs/uc3dK3bWJoQqCz9pYNMgW/bpSWjm/LaM5BP9XcQvmJIvic545dYmeCPXXD8PWMh82mKOvkyCjccEbUafWHkiUZLgl4xc5nm22SU+wQH8Ets7+NIC3hKC8sKRRe2p7RBj6yv7M1OdUUm+a7hbyE95YSLxLqTqoVUtp4YRdUxJQin4M22PZwO9f700HGTIQ8Jty6XCL6gN7AzRslhvFFQRtrh4uYNkuIwu4CLznuinyCSWzhGq0jLvFQFBxnnNg6iWc124DissOVlOl57+DQSm4DYcrLKyJZVZYxXZYECgYEA8HWC4JgiBl9lO+gv4Fn6iCxfFIfOoVMtJaKxlJcOtoXwIMEMwdsV/bmWC3f3W3SJlRA4IgpAtynoSYbEU9LYeUZPyKhiE44KwzeTkA2kyLKcmSQl5JmdWcPtowVuyEp/TK1uynG+lt87J2Jyz6aypN8hYrwsAhfof5luE5GvSWUCgYEAptksGccMfQQUP6LsAISdLCUZ0U1l/AC4NonVfrjy4PlLg4ICfNS1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'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnLgv5fv2ernleOuSR2val8nmWWp42XPZrD9HNpgR/rDy7D/u2QDXzEbKyNZhe26vTo7uxC9vVczRD5iwBCGXLdrCSFPZdbtuqHH0MTb6WEVE3hhPWZ89WMN5TiQwtMjdBLBeNgXC2JyP6uxAItQgpQnPjwcVua5UsUNG2P89/g6YISfrYBpYZVF57ennlePPwhHYnYlTrdRlPP39JOEiz5YfBIlm3ZTFMSfSgHQKWVipJuR+/zhKb53msmZqs18RNpGm3TEedfgQYMOd6z5Ybl6s1oEd9o5n2VDzRrLXKrA7dKrEKjeEGztZNXV6LvShU2kq+j1/mauuaS7XBLAW/QIDAQAB';
    protected $notify_url = ''; //通知接口
    /**
     * 应用公钥：
     * MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnLgv5fv2ernleOuSR2val8nmWWp42XPZrD9HNpgR/rDy7D/u2QDXzEbKyNZhe26vTo7uxC9vVczRD5iwBCGXLdrCSFPZdbtuqHH0MTb6WEVE3hhPWZ89WMN5TiQwtMjdBLBeNgXC2JyP6uxAItQgpQnPjwcVua5UsUNG2P89/g6YISfrYBpYZVF57ennlePPwhHYnYlTrdRlPP39JOEiz5YfBIlm3ZTFMSfSgHQKWVipJuR+/zhKb53msmZqs18RNpGm3TEedfgQYMOd6z5Ybl6s1oEd9o5n2VDzRrLXKrA7dKrEKjeEGztZNXV6LvShU2kq+j1/mauuaS7XBLAW/QIDAQAB
     */
    /**
     * 应用私钥：
     * MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCcuC/l+/Z6ueV465JHa9qXyeZZanjZc9msP0c2mBH+sPLsP+7ZANfMRsrI1mF7bq9Oju7EL29VzNEPmLAEIZct2sJIU9l1u26ocfQxNvpYRUTeGE9Znz1Yw3lOJDC0yN0EsF42BcLYnI/q7EAi1CClCc+PBxW5rlSxQ0bY/z3+DpghJ+tgGlhlUXn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2rGllwhBugDEbd9KovPwvzhps27//P6vKrnLlbI/RQF+dXK9zNfd6+XbZGpBFw3euh/ab2NvMe1a2uxWnereNLd8zO1qgf+1JLtN94jp5Yo5A1c0vI88m7Qi1Jp8J157xSAEohAoGAbblslSAaQzNxpxO6GpbkXFiX8O7u0nAm24SGPm3r97LurQlK13qip2ITO2+Faezt5YmvfLN+qMGAsE42YBx7tWTv+qsx5iTx1teIYZcKjuzHJTB8Whqfx7zpNaUBeWzWQwd5EPyMk0p/ldtiuUHeosFGE2pfrhKvReFWhSxIJvA=
     */
    /**
     * 支付宝公钥：
     * MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyYKmb81fwp2mEOKHivAJX7X8Givpxg55y5h1+YW4K66MtvlCiIGAB9BJrV1bAkAACkKcdV4JxuH7Magq2aQu5Qhfn+xJt6EkcLlQMpV4daKOdnriIicpVnsQuNiNt2TNskGxgvlTUO10s1qf6Gj/q6eu+Y2/DbhnyJPsHaqfmpqHnaOVi3jqDBHEe/7xsBZEEPETWmqgH9I6/BEUcMGDnPD/B3y0tbGCkZNi+TZVBnmW9cVrWTgVy6J4CwXKGkTapdREw0exozHnmgOsL7KuOaqBE8NDanFiHtMwuXyv6RIqJ6Yb5KkWkFSXgJalmL4ddEaIHz0mTiI3Bcp/i/Co+wIDAQAB
     */
    //加密方式AES：H72xzuQ2NjwJLkIoSytoMA==
    //商户号：2088602245290961

    public function test(){
    }

//    public function __construct(PayService $service)
//    {
//        $this->db = $service;
//        $this->rsaPrivateKeyFilePath = 'zfb/rsaPrivateKeyFilePath.txt';
////        $this->rsaPrivateKey = '-----BEGIN PRIVATE KEY-----\n'.$this->rsaPrivateKey.'-----END PRIVATE KEY-----';
//        $this->notify_url = env('DOMAIN') . '/api/front/pay/zfb/notice';
//    }

//    //测试
//    public function test(){
////        echo phpinfo();
//        $a = new \AopClient(
//            $this->app_id, $this->rsaPrivateKeyFilePath,
//            $this->rsaPrivateKey, $this->alipayPublicKey,
//            $this->alipayrsaPublicKey
//        );
//        $b = new \AlipayAppTokenGetRequest();
//        $c = $a->execute($b);
//        ddd($c);
//    }

//    //PC支付宝支付
//    public function pay(Request $request)
//    {
//        $token = $request->post('token', ''); //登录token
//        $type = $request->post('type', 1); //1原创需求订单
//        $orderno = $request->post('orderno', 0); //订单号
//        $price = $this->db->orderPrice($type, $orderno);
//        if (!$price) {
//            return $this->toJson(-2, '价格错误');
//        }
//        $uOne = $this->db->userByToken($token);
//        if (!$uOne) {
//            return $this->toJson(-2, '未登录');
//        }
//    }

//    //支付宝通知
//    public function notice(Request $request)
//    {
//        $zfb = $request->all();
//        $zfb = json_encode($zfb, JSON_UNESCAPED_UNICODE);;
//        file_put_contents('zfb.sql', $zfb);
//    }
}